<template>
  <div :class="isShow==1?'zst':'zst noBanner'">
  		<!--浮框-->
		<div class="zst-box-flex-box1" v-if='isShow == 0?false:true && isShow1'>
			<!-- <span @click='isShow1 = !isShow1;'>x</span> -->
			<a :href="AdUrl" class="goBaiduAd"><img :src="AdImg"></a>
		</div>
		<div class="zst-box-flex-box2" v-if='isShow == 0?false:true && isShow2'>
			<!-- <span @click='isShow2 = !isShow2'>x</span> https://h.5106cai.com/czbdown/down.html-->
			<a href="javascript:;" @click='goUrl("http://h.5106cai.com/czbdown/down.html")'><img src="../../assets/zst/btn.png"></a>
		</div>
  		<!-- 快频彩 -->
		<template v-if='name.indexOf("11选5")>-1 || name.indexOf("全运彩")>-1'>
			<temp-l11x5 :gid='gid' :currentNavs='currentNav'></temp-l11x5>
		</template>
		<template v-else-if='name.indexOf("快3")>-1'>
			<temp-lk3 :gid='gid' :currentNavs='currentNav'></temp-lk3>
		</template>
		<template v-else-if='name.indexOf("时时乐")>-1'>
			<temp-lssl :gid='gid' :currentNavs='currentNav'></temp-lssl>
		</template>
		<template v-else-if='name.indexOf("时时彩")>-1'>
			<temp-lssc :gid='gid' :currentNavs='currentNav'></temp-lssc>
		</template>
		<template v-else-if='name.indexOf("快乐8")>-1'>
			<temp-lk8 :gid='gid' :currentNavs='currentNav'></temp-lk8>
		</template>
		<template v-else-if='name.indexOf("快乐十分")>-1'>
			<temp-lk10 :gid='gid' :currentNavs='currentNav'></temp-lk10>
		</template>
		<template v-else-if='name.indexOf("快乐12")>-1'>
			<temp-lk12 :gid='gid' :currentNavs='currentNav'></temp-lk12>
		</template>
		<template v-else-if='name.indexOf("PK拾")>-1'>
			<temp-lpk10 :gid='gid' :currentNavs='currentNav'></temp-lpk10>
		</template>
		<!--地方彩 -->
		<template v-else-if='name.indexOf("15选5")>-1'>
			<temp-l15x5 :gid='gid' :currentNavs='currentNav'></temp-l15x5>
		</template>
		<template v-else-if='name.indexOf("6+1")>-1'>
			<temp-l6Add12 v-if='name.indexOf("黑龙江6+1")>-1||name.indexOf("浙江体彩6+1")>-1' :gid='gid' :currentNavs='currentNav'></temp-l6Add12>
			<temp-l6Add1 v-else :gid='gid' :currentNavs='currentNav'></temp-l6Add1>
		</template>
		<template v-else-if='name.indexOf("排列5")>-1'>
			<temp-lp5AD :gid='gid' :currentNavs='currentNav'></temp-lp5AD>
		</template>
		<template v-else-if='name.indexOf("20选5")>-1'>
			<temp-l20x5 :gid='gid' :currentNavs='currentNav'></temp-l20x5>
		</template>
		<template v-else-if='name.indexOf("排列7")>-1||name.indexOf("排列七")>-1'>
			<temp-lp7AD :gid='gid' :currentNavs='currentNav'></temp-lp7AD>
		</template>
		<template v-else-if='name.indexOf("好运2")>-1'>
			<temp-lh2 :gid='gid' :currentNavs='currentNav'></temp-lh2>
		</template>
		<template v-else-if='name.indexOf("好运3")>-1'>
			<temp-lh3 :gid='gid' :currentNavs='currentNav'></temp-lh3>
		</template>
		<template v-else-if='name.indexOf("35选7")>-1'>
			<temp-l35x7 :gid='gid' :currentNavs='currentNav'></temp-l35x7>
		</template>
		<template v-else-if='name.indexOf("36选7")>-1'>
			<temp-l36x7 :gid='gid' :currentNavs='currentNav'></temp-l36x7>
		</template>
		<template v-else-if='name.indexOf("22选5")>-1'>
			<temp-l22x5 :gid='gid' :currentNavs='currentNav'></temp-l22x5>
		</template>
		<template v-else-if='name.indexOf("p62")>-1'>
			<temp-lp62 :gid='gid' :currentNavs='currentNav'></temp-lp62>
		</template>
		<template v-else-if='name.indexOf("天天彩选4")>-1'>
			<temp-lttcx4 :gid='gid' :currentNavs='currentNav'></temp-lttcx4>
		</template>
		<template v-else-if='name.indexOf("7位数")>-1'>
			<temp-l7ws :gid='gid' :currentNavs='currentNav'></temp-l7ws>
		</template>
		<template v-else-if='name.indexOf("31选7")>-1'>
			<temp-l31x7 :gid='gid' :currentNavs='currentNav'></temp-l31x7>
		</template>
		<template v-else-if='name.indexOf("30选5")>-1'>
			<temp-l30x5 :gid='gid' :currentNavs='currentNav'></temp-l30x5>
		</template>
		<template v-else-if='name.indexOf("好彩1")>-1'>
			<temp-lhc1 :gid='gid' :currentNavs='currentNav'></temp-lhc1>
		</template>
		<template v-else-if='name.indexOf("深圳风采")>-1'>
			<temp-lszfc :gid='gid' :currentNavs='currentNav'></temp-lszfc>
		</template>
		<template v-else-if='name.indexOf("快乐双彩")>-1'>
			<temp-lklsc :gid='gid' :currentNavs='currentNav'></temp-lklsc>
		</template>
		<template v-else-if='name.indexOf("4+1")>-1'>
			<temp-l4Add1 :gid='gid' :currentNavs='currentNav'></temp-l4Add1>
		</template>
		<template v-else-if='name.indexOf("25选7")>-1'>
			<temp-l25x7 :gid='gid' :currentNavs='currentNav'></temp-l25x7>
		</template>
		<template v-else-if='name.indexOf("18选7")>-1'>
			<temp-l18x7 :gid='gid' :currentNavs='currentNav'></temp-l18x7>
		</template>
		<!--全国彩-->
		<template v-else-if='name.indexOf("排列五")>-1'>
			<temp-lp5 :gid='gid' :currentNavs='currentNav'></temp-lp5>
		</template>
		<template v-else-if='name.indexOf("双色球")>-1'>
			<temp-lssq :gid='gid' :currentNavs='currentNav'></temp-lssq>
		</template>
		<template v-else-if='name.indexOf("超级大乐透")>-1'>
			<temp-ldlt :gid='gid' :currentNavs='currentNav'></temp-ldlt>
		</template>
		<template v-else-if='name.indexOf("福彩3D")>-1'>
			<temp-l3D :gid='gid' :currentNavs='currentNav'></temp-l3D>
		</template>
		<template v-else-if='name.indexOf("排列三")>-1'>
			<temp-lp3 :gid='gid' :currentNavs='currentNav'></temp-lp3>
		</template>
		<template v-else-if='name.indexOf("七星彩")>-1'>
			<temp-lqxc :gid='gid' :currentNavs='currentNav'></temp-lqxc>
		</template>
		<template v-else-if='name.indexOf("七乐彩")>-1'>
			<temp-lqlc :gid='gid' :currentNavs='currentNav'></temp-lqlc>
		</template>
		<template v-else>
			<error></error>
		</template>
		
  </div>
</template>

<script>
import TempL11x5 from './11x5';
import TempLk3 from './k3';
import TempLssl from './ssl';
import TempLssc from './ssc';
import TempLk8 from './k8';
import TempLk10 from './k10';
import TempLk12 from './k12';
import TempL15x5 from './15x5';
import TempL6Add1 from './6Add1';
import TempL6Add12 from './6Add12';
import TempLp5 from './p5';
import TempLp5AD from './p5AD';
import TempL20x5 from './20x5';
import TempLp7AD from './p7AD';
import TempLh2 from './h2';
import TempLh3 from './h3';
import TempL35x7 from './35x7';
import TempL36x7 from './36x7';
import TempL22x5 from './22x5';
import TempLp62 from './p62';
import TempLttcx4 from './ttcx4';
import TempL7ws from './7ws';
import TempL31x7 from './31x7';
import TempL30x5 from './30x5';
import TempLhc1 from './hc1';
import TempLszfc from './szfc';
import TempLklsc from './klsc';
import TempL4Add1 from './4Add1';
import TempL25x7 from './25x7';
import TempL18x7 from './18x7';
import TempLssq from './ssq';
import TempLdlt from './dlt';
import TempL3D from './3D';
import TempLp3 from './p3';
import TempLqxc from './qxc';
import TempLqlc from './qlc';
import TempLpk10 from './pk10';
import error from '../error';
import {getAdvertiSense} from '@/api/whole';
export default {
	data() {
	    return {
	    	gid:'',
	    	name:'',
	    	currentNav:'',
	    	isShow:0,
	    	timestampe: {
		        // reqsign: "",
		        timestamp: "",
		        cfrom: "h5"
		    },
		    appSecret: "recommend_20200521",
		    AdImg:'',
		    AdUrl:'',
		    qgcGid:{
		    	'52':{
		    		name:'排列五',
		    		adUrl:'pl5_active',
		    		imgUrl:'52.png'
		    	},
		    	'53':{
		    		name:'排列三',
		    		adUrl:'pl3_active',
		    		imgUrl:'53.png'
		    	},
		    	'50':{
		    		name:'超级大乐透',
		    		adUrl:'dlt_active',
		    		imgUrl:'50.png'
		    	},
		    	'51':{
		    		name:'七星彩',
		    		adUrl:'qxc_active',
		    		imgUrl:'51.png'
		    	},
		    	'07':{
		    		name:'七乐彩',
		    		adUrl:'qlc_active',
		    		imgUrl:'07.png'
		    	},
		    	'03':{
		    		name:'福彩3D',
		    		adUrl:'3d_active',
		    		imgUrl:'03.png'
		    	},
		    	'01':{
		    		name:'双色球',
		    		adUrl:'ssq_active',
		    		imgUrl:'01.png'
		    	},
		    },
		    isQGC:false,
		    isShow1:true,
		    isShow2:true,
		    ssqLotteryData:'0,2,4',//双色球开奖日期
      		dltLotteryData:'1,3,6', //大乐透开奖日期
	    }
	 },
	components:{
		TempL11x5,
		TempLk3,
		TempLssl,
		TempLssc,
		TempLk8,
		TempLk10,
		TempLk12,
		TempL15x5,
		TempL6Add1,
		TempL6Add12,
		TempLp5,
		TempLp5AD,
		TempL20x5,
		TempLp7AD,
		TempLh2,
		TempLh3,
		TempL35x7,
		TempL36x7,
		TempL22x5,
		TempLp62,
		TempLttcx4,
		TempL7ws,
		TempL31x7,
		TempL30x5,
		TempLhc1,
		TempLszfc,
		TempLklsc,
		TempL4Add1,
		TempL25x7,
		TempL18x7,
		TempLssq,
		TempLdlt,
		TempL3D,
		TempLp3,
		TempLqxc,
		TempLqlc,
		TempLpk10,
		error
	},
	methods:{
		getAdvertiSenseFun(){
			var timestamp = new Date().valueOf();
			this.timestampe.timestamp = timestamp;
	      	getAdvertiSense({
	      		cfrom: "h5",
        		position:this.gid
	      	}).then(res=>{
               this.isShow = res.data.isShow;
               // this.isLotteryData();
            })
		},
		isLotteryData(){
	      let week = new Date().getDay();
	      if (this.gid == '01') {//双色球
	        if (this.ssqLotteryData.indexOf(week)>-1) {
	          this.isShow = 1;
	          console.count('isShow被调用了',this.isShow);
	        }
	      }
	      if (this.gid == '50') {//大乐透
	        if (this.dltLotteryData.indexOf(week)>-1) {    
	          this.isShow = 1;
	          console.count('isShow被调用了',this.isShow);
	        }
	      }
	    },
	    goUrl(item){
	        window.location.href = item
	    },
	},
	created(){
		this.gid = this.$route.params.gid;
		this.name = this.lottery[this.gid].name;
		this.currentNav = this.$route.params.current;
		this.getAdvertiSenseFun();
		//png图
		for(let key in this.qgcGid){
			if (this.gid == key) {
				this.isQGC = true
			}
		};
		if (this.lottery[this.gid].type == 0 || this.qgcGid[this.gid]) { //全国彩
			this.AdImg = require('../../assets/zst/'+this.qgcGid[this.gid].imgUrl);
			this.AdUrl = 'http://h.5106cai.com/'+this.qgcGid[this.gid].adUrl+'/?cf=zs#/'
		}else if(this.lottery[this.gid].type == 1){ //地方彩
			this.AdImg = require('../../assets/zst/288.png');
			this.AdUrl = 'http://h.5106cai.com/regit_active/?cf=zs1#/'
		}else{ //高频彩
			this.AdImg = require('../../assets/zst/288.png');
			this.AdUrl = 'http://h.5106cai.com/regit_active/?cf=zs2#/'
		}
	},
	mounted () {
		let obj = document.getElementsByClassName('chart-container')[0];
		let hei = document.documentElement.clientHeight;
		let winWid = document.body.clientWidth;
		let page =  document.getElementsByClassName('page');
		if ('01,03,50,53'.indexOf(this.gid)>-1) {
			obj.style.height = (hei-231)+'px';
		}else{
			obj.style.height = (hei-125)+'px';
		}
		page.forEach((item)=>{
			let widStrong = item.style.width.toString()
			if (widStrong.indexOf('100%')>-1) {
				return
			}
	      	let ObjWid = parseInt(item.style.width)==0?'900':parseInt(item.style.width);
	      	if (ObjWid < winWid) {
	      		console.log(ObjWid,winWid)
	      		item.style = 'width:'+winWid+'px';
	      	}
	    })
	}
};
</script>

<style lang="less" scoped>

	.zst-box-flex-box1{
		position: fixed;
		width: 75px;
		height: 81px;
		bottom: 30%;
		// top: 70px;
		right:15px;
		z-index: 9999;
		span{
			position:absolute;
			width: 20px;
			height: 20px;
			line-height: 20px;
			font-size: 18px;
			text-align: center;
			color: #000;
			top: -30px;
			right: -10px;
			background:rgba(255,255,255);
			border-radius: 50%;
		}
		img{
			width: auto;
			height:78px;
		}
	}
	.zst-box-flex-box2{
		position: fixed;
		width: 202px;
		height: 50px;
		bottom: 40px;
		// bottom: -11px;
		left: 50%;
		z-index: 9999;
		margin-left: -101px;
		span{
			position:absolute;
			width: 20px;
			height: 20px;
			line-height: 20px;
			font-size: 18px;
			text-align: center;
			color: #000;
			top: -30px;
			right: -10px;
			background:rgba(255,255,255);
			border-radius: 50%;
		}
		a{
			width: 100%;
			display: block;
			font-size: 16px;
			color: #fff;
			text-align: center;
			height: 50px;
			line-height: 50px;
			text-decoration: none;
			img{
				width: 100%;
				height: auto;
			}
		}
	}
</style>

